home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1996 / MacHack 1996.toast / Hacks / Hacks ’92 / NetWarmer / source / Globals.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-06-22  |  1.3 KB  |  75 lines  |  [TEXT/KAHL]

  1. /* Globals.c */
  2. /* Created 3/13/4 1:08 PM by AppMaker */
  3.  
  4.  
  5. #include "Globals.h"
  6.  
  7. #define NIL            0L
  8.  
  9. /*Standard vars:*/
  10. Boolean            quittingTime;                             
  11. EventRecord        curEvent;                          
  12. WindowPtr        curWindow;
  13. WinInfoPtr        cur;
  14. Boolean            inBackground;
  15.  
  16. WinInfoRec        noCur;
  17.  
  18. /*----------*/
  19. void InitGlobals ()
  20. {
  21.     curWindow = nil;
  22.     noCur.text = nil;
  23.     noCur.vScroll = nil;
  24.     noCur.hScroll = nil;
  25.     noCur.fileNum = 0;
  26.     noCur.volNum = 0;
  27.     noCur.dirty = false;
  28.     noCur.windowKind = noWindow;
  29.     cur = &noCur;
  30. } /*InitGlobals*/
  31.  
  32. /*----------*/
  33. void SetInfo (window)
  34. WindowPtr        window;
  35. {
  36.     WinInfoPtr        infoPtr;
  37.  
  38.     if (window != curWindow) {
  39.         curWindow = window;
  40.         if (curWindow != nil) {
  41.             infoPtr = (WinInfoPtr) GetWRefCon (curWindow);
  42.             cur = infoPtr;
  43.         } else {
  44.             cur = &noCur;
  45.         } /*if*/
  46.     } /*if*/
  47. } /*SetInfo*/
  48.  
  49. /*----------*/
  50. void SetNewInfo (window)
  51. WindowPtr        window;
  52. {
  53.     WinInfoPtr        infoPtr;
  54.  
  55.     infoPtr = (WinInfoPtr) NewPtr (sizeof (WinInfoRec));
  56.     SetWRefCon (window, (long) infoPtr);
  57.     SetInfo (window);
  58. } /*SetNewInfo*/
  59.  
  60. /*----------*/
  61. void DiscardInfo (window)
  62. WindowPtr        window;
  63. {
  64.     WinInfoPtr        infoPtr;
  65.  
  66.     if (window == curWindow) {
  67.         SetInfo (nil);
  68.     }
  69.     infoPtr = (WinInfoPtr) GetWRefCon (window);
  70.     DisposPtr ((Ptr) infoPtr);
  71.     HideWindow (window);
  72.     DisposeWindow (window);
  73. } /*DiscardInfo*/
  74.  
  75. /* Globals */